{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "62549efe",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# Query Analyzer\n",
    "\n",
    "A query analyzer is a frequent component of information retrieval systems that helps to improve the relevance of retrieved results.\n",
    "\n",
    "The analyzer takes as input a raw search query from the user (e.g., \"cheap restaurants near me\") together with additional metadata, \n",
    "and translates the query into a more precise structured query.\n",
    "\n",
    "The resulting structured query could look like:\n",
    "\n",
    "```json\n",
    "{\n",
    "    \"text\": null,\n",
    "    \"entity_type\": \"restaurant\",\n",
    "    \"filters\": [\n",
    "        {\n",
    "            \"attribute\": \"price\",\n",
    "            \"op\": \"<\",\n",
    "            \"value\": 100\n",
    "        },\n",
    "        {\n",
    "            \"attribute\": \"location\",\n",
    "            \"op\": \"near\",\n",
    "            \"value\": \"user_geo_location\"\n",
    "        }        \n",
    "    ]\n",
    "}\n",
    "```\n",
    "\n",
    "\n",
    "To illustrate how `Kork` can be used, let's re-implemnt the query analyzer implemented in \n",
    "langchain using the [QueryConstructor chain](https://github.com/hwchase17/langchain/tree/8de1b4c4c20ea81f44628a1c42fbc1bbfff37520/langchain/chains/query_constructor)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "79fd8e41",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    },
    "nbsphinx": "hidden",
    "pycharm": {
     "name": "#%%\n"
    },
    "tags": [
     "remove_cell"
    ]
   },
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "import sys\n",
    "\n",
    "sys.path.insert(0, \"../\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ff38ea21-b562-4c13-be0f-c394843bfe39",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "import langchain\n",
    "from langchain.llms import OpenAI\n",
    "from typing import List, Any\n",
    "from kork import CodeChain"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8280c89f-505e-463a-921c-fb1f608b5269",
   "metadata": {},
   "source": [
    "## Filters\n",
    "\n",
    "We'll define some functions that can be used for query analysis as foreign functions.\n",
    "\n",
    "```{note}\n",
    "\n",
    "The representation of a function per binary operator seemed to work better than a more\n",
    "generic representation of using a single function:\n",
    "\n",
    "def f_(attribute: str, op: Any, value: Any) -> Any:\n",
    "   \"\"\"Apply a filter on the given attribute with an operator (\">\", \"<\", \"=\", ...) and value.\"\"\"\n",
    "   ...\n",
    "\n",
    "\n",
    "As an experiment, you could try to swap to the more generic representation and see\n",
    "if you can get it working well!\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "3bf8a1ae-3bd4-430d-9de8-cc488e64290e",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "def gt(attribute: str, value: Any) -> Any:\n",
    "    \"\"\"Filter to where attribute > value\"\"\"\n",
    "    return {\"attribute\": attribute, \"op\": \">\", \"value\": value}\n",
    "\n",
    "\n",
    "def gte(attribute: str, value: Any) -> Any:\n",
    "    \"\"\"Filter to where attribute >= value\"\"\"\n",
    "    return {\"attribute\": attribute, \"op\": \">=\", \"value\": value}\n",
    "\n",
    "\n",
    "def eq(attribute: str, value: Any) -> Any:\n",
    "    \"\"\"Filter to where attribute = value\"\"\"\n",
    "    return {\"attribute\": attribute, \"op\": \"=\", \"value\": value}\n",
    "\n",
    "\n",
    "def neq(attribute: str, value: Any) -> Any:\n",
    "    \"\"\"Filter to where attribute != value\"\"\"\n",
    "    return {\"attribute\": attribute, \"op\": \"!=\", \"value\": value}\n",
    "\n",
    "\n",
    "def lte(attribute: str, value: Any) -> Any:\n",
    "    \"\"\"Filter to where attribute <= value\"\"\"\n",
    "    return {\"attribute\": attribute, \"op\": \"<=\", \"value\": value}\n",
    "\n",
    "\n",
    "def lt(attribute: str, value: Any) -> Any:\n",
    "    \"\"\"Filter to where attribute < value\"\"\"\n",
    "    return {\"attribute\": attribute, \"op\": \"<\", \"value\": value}\n",
    "\n",
    "\n",
    "def and_(filters: List[Any]) -> Any:\n",
    "    \"\"\"Combine a list of filters using an AND operator.\"\"\"\n",
    "    return {\n",
    "        \"op\": \"and\",\n",
    "        \"filters\": [filters],\n",
    "    }\n",
    "\n",
    "\n",
    "def or_(filters: List[Any]) -> Any:\n",
    "    \"\"\"Combine a list of filters using an OR operator.\"\"\"\n",
    "    return {\n",
    "        \"op\": \"or_\",\n",
    "        \"filters\": [filters],\n",
    "    }\n",
    "\n",
    "\n",
    "def in_(attribute: str, value: List[Any]) -> Any:\n",
    "    \"\"\"Filter to where attribute >= value\"\"\"\n",
    "    return {\"attribute\": attribute, \"op\": \"in\", \"value\": value}\n",
    "\n",
    "\n",
    "def request(query: str, filters: List[Any]) -> Any:\n",
    "    return {\n",
    "        \"query\": query,\n",
    "        \"filters\": filters,\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "93dbe73f-7d5f-4b78-ab14-8563177b5555",
   "metadata": {},
   "source": [
    "## The prompt\n",
    "\n",
    "Let's define a prompt to explain the task.\n",
    "\n",
    "You can experiment with the prompt to see if you could improve it!\n",
    "\n",
    "See the [prompt](https://github.com/hwchase17/langchain/blob/8de1b4c4c20ea81f44628a1c42fbc1bbfff37520/langchain/chains/query_constructor/prompt.py) in the Langchain `query constructor` chain for insipiration."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f36dce18-ba71-409d-81f2-3d10561c2098",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "from langchain.prompts import PromptTemplate\n",
    "\n",
    "template = \"\"\"\\\n",
    "Your task is to analyze the user's query and translate it into a search request composed \\\n",
    "of a search string and a filter.\n",
    "\n",
    "Here is a set of functions that you can rely on: \n",
    "\n",
    "{external_functions_block}\n",
    "\n",
    "Here is a schema of the data being queried.\n",
    "\n",
    "```TypeScript \n",
    "\n",
    "type schema = {{\n",
    "  author: string // The author of the document\n",
    "  pub_year: string // 4 digit format year representing year when doc was published\n",
    "  price: number // how much it costs to buy the document\n",
    "}}\n",
    "```\n",
    "\n",
    "Filter attributes must match the data schema. If the query seems to include other attributes, \\\n",
    "assume those are not filters, but part of the search string.\n",
    "Pay attention to the doc string in the schema for each attribute. If it doesn't look like the \\\n",
    "usage of the filter does not match the description in comment treat it as part of the search query.\n",
    "\n",
    "Filters can be combined using `and_` and `or_`.\n",
    "\n",
    "Please encapsulate the code in <code> and </code> tags.\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "ebba18e9-6789-431e-b3b8-edc9b8a5fe02",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "prompt_template = PromptTemplate(\n",
    "    template=template, input_variables=[\"external_functions_block\"]\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5a474452-a461-41aa-8198-4b5aa3248514",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## Examples\n",
    "\n",
    "Now, define some example programs."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "72ce30e4-0453-4e93-a9f5-6c53bfe6b34a",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "from kork.parser import parse\n",
    "\n",
    "examples = [\n",
    "    (\n",
    "        \"documents published after 2020\",\n",
    "        'var result = request(null, gte(\"pub_year\", 2020))',\n",
    "    ),\n",
    "    (\n",
    "        \"toy models of cars by john smith or ones that were published after 2012\",\n",
    "        'var result = request(\"toy models of cars\", or_([eq(\"author\", \"john smith\"), gte(\"pub_year\", 2012)]))',\n",
    "    ),\n",
    "    (\n",
    "        \"share prices by john or oliver\",\n",
    "        'var result = request(\"share prices\", in(\"author\", [\"john\", \"oliver\"]))',\n",
    "    ),\n",
    "]\n",
    "\n",
    "examples_in_ast = [(query, parse(code)) for query, code in examples]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "5b3ab1f4-812e-4747-912b-9d7521dfe7b4",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "('documents published after 2020',\n",
       " Program(stmts=(VarDecl(name='result', value=FunctionCall(name='request', args=(Literal(value=None), FunctionCall(name='gte', args=(Literal(value='pub_year'), Literal(value=2020)))))),)))"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "examples_in_ast[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "17b7b765-f80e-4b54-87ad-fbf144ae2223",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## Let's test it out"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "db474c2a-eb99-4260-9bd8-da8b6eec5564",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "llm = OpenAI(\n",
    "    model_name=\"text-davinci-003\",\n",
    "    temperature=0,\n",
    "    max_tokens=3000,\n",
    "    frequency_penalty=0,\n",
    "    presence_penalty=0,\n",
    "    top_p=1.0,\n",
    "    verbose=True,\n",
    ")\n",
    "\n",
    "chain = CodeChain.from_defaults(\n",
    "    llm=llm,\n",
    "    examples=examples_in_ast,\n",
    "    context=[gte, gt, eq, neq, lte, lt, in_, and_, or_, request],\n",
    "    instruction_template=prompt_template,\n",
    "    input_formatter=None,\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "3144b036-9fa4-4241-8475-e674df44d9e8",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "langchain.verbose = False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "2e240914-00da-43f6-98f8-004bc53df982",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "queries = [\n",
    "    \"publications by mama bear published after 2013\",\n",
    "    \"documents about florida from 2013 or docs written by mama bear\",\n",
    "    \"smells like sunshine\",\n",
    "    \"documents that discuss $5\",\n",
    "    \"documents that discuss the $50 debt of the bank\",\n",
    "    \"docs that cost more than $150\",\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "352ddee3-107e-4749-ab1b-6541a7b929e6",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "results = []\n",
    "\n",
    "for query in queries:\n",
    "    results.append(chain(inputs={\"query\": query}))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "0a5b9ef6-61fd-4fb3-9160-2cb963be8fbf",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "from kork.display import as_html_dict, display_html_results"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2a69fa2d-6c31-41ec-b136-aff1d8228127",
   "metadata": {},
   "source": [
    "Examine the results below carefully! Not all the generated requests are correct. `errors` means that there were no runtime exceptions, not that the result is correct."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "8273f8d6-4cda-4530-85c1-354cb6281f41",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_4c82e_row0_col0, #T_4c82e_row0_col1, #T_4c82e_row0_col2, #T_4c82e_row0_col3, #T_4c82e_row1_col0, #T_4c82e_row1_col1, #T_4c82e_row1_col2, #T_4c82e_row1_col3, #T_4c82e_row2_col0, #T_4c82e_row2_col1, #T_4c82e_row2_col2, #T_4c82e_row2_col3, #T_4c82e_row3_col0, #T_4c82e_row3_col1, #T_4c82e_row3_col2, #T_4c82e_row3_col3, #T_4c82e_row4_col0, #T_4c82e_row4_col1, #T_4c82e_row4_col2, #T_4c82e_row4_col3, #T_4c82e_row5_col0, #T_4c82e_row5_col1, #T_4c82e_row5_col2, #T_4c82e_row5_col3 {\n",
       "  text-align: left;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_4c82e\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_4c82e_level0_col0\" class=\"col_heading level0 col0\" >query</th>\n",
       "      <th id=\"T_4c82e_level0_col1\" class=\"col_heading level0 col1\" >code</th>\n",
       "      <th id=\"T_4c82e_level0_col2\" class=\"col_heading level0 col2\" >result</th>\n",
       "      <th id=\"T_4c82e_level0_col3\" class=\"col_heading level0 col3\" >errors</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_4c82e_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "      <td id=\"T_4c82e_row0_col0\" class=\"data row0 col0\" >publications by mama bear<br/>published after 2013</td>\n",
       "      <td id=\"T_4c82e_row0_col1\" class=\"data row0 col1\" ><style>pre { line-height: 125%; }<br/>td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>.output_html .hll { background-color: #ffffcc }<br/>.output_html { background: #f8f8f8; }<br/>.output_html .c { color: #3D7B7B; font-style: italic } /* Comment */<br/>.output_html .err { border: 1px solid #FF0000 } /* Error */<br/>.output_html .k { color: #008000; font-weight: bold } /* Keyword */<br/>.output_html .o { color: #666666 } /* Operator */<br/>.output_html .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */<br/>.output_html .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */<br/>.output_html .cp { color: #9C6500 } /* Comment.Preproc */<br/>.output_html .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */<br/>.output_html .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */<br/>.output_html .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */<br/>.output_html .gd { color: #A00000 } /* Generic.Deleted */<br/>.output_html .ge { font-style: italic } /* Generic.Emph */<br/>.output_html .gr { color: #E40000 } /* Generic.Error */<br/>.output_html .gh { color: #000080; font-weight: bold } /* Generic.Heading */<br/>.output_html .gi { color: #008400 } /* Generic.Inserted */<br/>.output_html .go { color: #717171 } /* Generic.Output */<br/>.output_html .gp { color: #000080; font-weight: bold } /* Generic.Prompt */<br/>.output_html .gs { font-weight: bold } /* Generic.Strong */<br/>.output_html .gu { color: #800080; font-weight: bold } /* Generic.Subheading */<br/>.output_html .gt { color: #0044DD } /* Generic.Traceback */<br/>.output_html .kc { color: #008000; font-weight: bold } /* Keyword.Constant */<br/>.output_html .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */<br/>.output_html .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */<br/>.output_html .kp { color: #008000 } /* Keyword.Pseudo */<br/>.output_html .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */<br/>.output_html .kt { color: #B00040 } /* Keyword.Type */<br/>.output_html .m { color: #666666 } /* Literal.Number */<br/>.output_html .s { color: #BA2121 } /* Literal.String */<br/>.output_html .na { color: #687822 } /* Name.Attribute */<br/>.output_html .nb { color: #008000 } /* Name.Builtin */<br/>.output_html .nc { color: #0000FF; font-weight: bold } /* Name.Class */<br/>.output_html .no { color: #880000 } /* Name.Constant */<br/>.output_html .nd { color: #AA22FF } /* Name.Decorator */<br/>.output_html .ni { color: #717171; font-weight: bold } /* Name.Entity */<br/>.output_html .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */<br/>.output_html .nf { color: #0000FF } /* Name.Function */<br/>.output_html .nl { color: #767600 } /* Name.Label */<br/>.output_html .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */<br/>.output_html .nt { color: #008000; font-weight: bold } /* Name.Tag */<br/>.output_html .nv { color: #19177C } /* Name.Variable */<br/>.output_html .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */<br/>.output_html .w { color: #bbbbbb } /* Text.Whitespace */<br/>.output_html .mb { color: #666666 } /* Literal.Number.Bin */<br/>.output_html .mf { color: #666666 } /* Literal.Number.Float */<br/>.output_html .mh { color: #666666 } /* Literal.Number.Hex */<br/>.output_html .mi { color: #666666 } /* Literal.Number.Integer */<br/>.output_html .mo { color: #666666 } /* Literal.Number.Oct */<br/>.output_html .sa { color: #BA2121 } /* Literal.String.Affix */<br/>.output_html .sb { color: #BA2121 } /* Literal.String.Backtick */<br/>.output_html .sc { color: #BA2121 } /* Literal.String.Char */<br/>.output_html .dl { color: #BA2121 } /* Literal.String.Delimiter */<br/>.output_html .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */<br/>.output_html .s2 { color: #BA2121 } /* Literal.String.Double */<br/>.output_html .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */<br/>.output_html .sh { color: #BA2121 } /* Literal.String.Heredoc */<br/>.output_html .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */<br/>.output_html .sx { color: #008000 } /* Literal.String.Other */<br/>.output_html .sr { color: #A45A77 } /* Literal.String.Regex */<br/>.output_html .s1 { color: #BA2121 } /* Literal.String.Single */<br/>.output_html .ss { color: #19177C } /* Literal.String.Symbol */<br/>.output_html .bp { color: #008000 } /* Name.Builtin.Pseudo */<br/>.output_html .fm { color: #0000FF } /* Name.Function.Magic */<br/>.output_html .vc { color: #19177C } /* Name.Variable.Class */<br/>.output_html .vg { color: #19177C } /* Name.Variable.Global */<br/>.output_html .vi { color: #19177C } /* Name.Variable.Instance */<br/>.output_html .vm { color: #19177C } /* Name.Variable.Magic */<br/>.output_html .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"k\">var</span><span class=\"w\"> </span><span class=\"n\">result</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"n\">request</span><span class=\"p\">(</span><span class=\"s2\">&quot;publications&quot;</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"n\">and_</span><span class=\"p\">([</span><span class=\"n\">eq</span><span class=\"p\">(</span><span class=\"s2\">&quot;author&quot;</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"s2\">&quot;mama bear&quot;</span><span class=\"p\">),</span><span class=\"w\"> </span><span class=\"n\">gte</span><span class=\"p\">(</span><span class=\"s2\">&quot;pub_year&quot;</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"mi\">2013</span><span class=\"p\">)]))</span><br/></pre></div></td>\n",
       "      <td id=\"T_4c82e_row0_col2\" class=\"data row0 col2\" >{&#x27;query&#x27;: &#x27;publications&#x27;, &#x27;filters&#x27;: {&#x27;op&#x27;: &#x27;and&#x27;, &#x27;filters&#x27;: [[{&#x27;attribute&#x27;: &#x27;author&#x27;, &#x27;op&#x27;: &#x27;=&#x27;, &#x27;value&#x27;: &#x27;mama bear&#x27;}, {&#x27;attribute&#x27;: &#x27;pub_year&#x27;, &#x27;op&#x27;: &#x27;&gt;=&#x27;, &#x27;value&#x27;: 2013}]]}}</td>\n",
       "      <td id=\"T_4c82e_row0_col3\" class=\"data row0 col3\" >[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_4c82e_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "      <td id=\"T_4c82e_row1_col0\" class=\"data row1 col0\" >documents about florida from<br/>2013 or docs written by mama<br/>bear</td>\n",
       "      <td id=\"T_4c82e_row1_col1\" class=\"data row1 col1\" ><style>pre { line-height: 125%; }<br/>td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>.output_html .hll { background-color: #ffffcc }<br/>.output_html { background: #f8f8f8; }<br/>.output_html .c { color: #3D7B7B; font-style: italic } /* Comment */<br/>.output_html .err { border: 1px solid #FF0000 } /* Error */<br/>.output_html .k { color: #008000; font-weight: bold } /* Keyword */<br/>.output_html .o { color: #666666 } /* Operator */<br/>.output_html .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */<br/>.output_html .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */<br/>.output_html .cp { color: #9C6500 } /* Comment.Preproc */<br/>.output_html .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */<br/>.output_html .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */<br/>.output_html .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */<br/>.output_html .gd { color: #A00000 } /* Generic.Deleted */<br/>.output_html .ge { font-style: italic } /* Generic.Emph */<br/>.output_html .gr { color: #E40000 } /* Generic.Error */<br/>.output_html .gh { color: #000080; font-weight: bold } /* Generic.Heading */<br/>.output_html .gi { color: #008400 } /* Generic.Inserted */<br/>.output_html .go { color: #717171 } /* Generic.Output */<br/>.output_html .gp { color: #000080; font-weight: bold } /* Generic.Prompt */<br/>.output_html .gs { font-weight: bold } /* Generic.Strong */<br/>.output_html .gu { color: #800080; font-weight: bold } /* Generic.Subheading */<br/>.output_html .gt { color: #0044DD } /* Generic.Traceback */<br/>.output_html .kc { color: #008000; font-weight: bold } /* Keyword.Constant */<br/>.output_html .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */<br/>.output_html .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */<br/>.output_html .kp { color: #008000 } /* Keyword.Pseudo */<br/>.output_html .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */<br/>.output_html .kt { color: #B00040 } /* Keyword.Type */<br/>.output_html .m { color: #666666 } /* Literal.Number */<br/>.output_html .s { color: #BA2121 } /* Literal.String */<br/>.output_html .na { color: #687822 } /* Name.Attribute */<br/>.output_html .nb { color: #008000 } /* Name.Builtin */<br/>.output_html .nc { color: #0000FF; font-weight: bold } /* Name.Class */<br/>.output_html .no { color: #880000 } /* Name.Constant */<br/>.output_html .nd { color: #AA22FF } /* Name.Decorator */<br/>.output_html .ni { color: #717171; font-weight: bold } /* Name.Entity */<br/>.output_html .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */<br/>.output_html .nf { color: #0000FF } /* Name.Function */<br/>.output_html .nl { color: #767600 } /* Name.Label */<br/>.output_html .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */<br/>.output_html .nt { color: #008000; font-weight: bold } /* Name.Tag */<br/>.output_html .nv { color: #19177C } /* Name.Variable */<br/>.output_html .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */<br/>.output_html .w { color: #bbbbbb } /* Text.Whitespace */<br/>.output_html .mb { color: #666666 } /* Literal.Number.Bin */<br/>.output_html .mf { color: #666666 } /* Literal.Number.Float */<br/>.output_html .mh { color: #666666 } /* Literal.Number.Hex */<br/>.output_html .mi { color: #666666 } /* Literal.Number.Integer */<br/>.output_html .mo { color: #666666 } /* Literal.Number.Oct */<br/>.output_html .sa { color: #BA2121 } /* Literal.String.Affix */<br/>.output_html .sb { color: #BA2121 } /* Literal.String.Backtick */<br/>.output_html .sc { color: #BA2121 } /* Literal.String.Char */<br/>.output_html .dl { color: #BA2121 } /* Literal.String.Delimiter */<br/>.output_html .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */<br/>.output_html .s2 { color: #BA2121 } /* Literal.String.Double */<br/>.output_html .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */<br/>.output_html .sh { color: #BA2121 } /* Literal.String.Heredoc */<br/>.output_html .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */<br/>.output_html .sx { color: #008000 } /* Literal.String.Other */<br/>.output_html .sr { color: #A45A77 } /* Literal.String.Regex */<br/>.output_html .s1 { color: #BA2121 } /* Literal.String.Single */<br/>.output_html .ss { color: #19177C } /* Literal.String.Symbol */<br/>.output_html .bp { color: #008000 } /* Name.Builtin.Pseudo */<br/>.output_html .fm { color: #0000FF } /* Name.Function.Magic */<br/>.output_html .vc { color: #19177C } /* Name.Variable.Class */<br/>.output_html .vg { color: #19177C } /* Name.Variable.Global */<br/>.output_html .vi { color: #19177C } /* Name.Variable.Instance */<br/>.output_html .vm { color: #19177C } /* Name.Variable.Magic */<br/>.output_html .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"k\">var</span><span class=\"w\"> </span><span class=\"n\">result</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"n\">request</span><span class=\"p\">(</span><span class=\"s2\">&quot;documents about florida&quot;</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"n\">or_</span><span class=\"p\">([</span><span class=\"n\">gte</span><span class=\"p\">(</span><span class=\"s2\">&quot;pub_year&quot;</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"mi\">2013</span><span class=\"p\">),</span><span class=\"w\"> </span><span class=\"n\">eq</span><span class=\"p\">(</span><span class=\"s2\">&quot;author&quot;</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"s2\">&quot;mama bear&quot;</span><span class=\"p\">)]))</span><br/></pre></div></td>\n",
       "      <td id=\"T_4c82e_row1_col2\" class=\"data row1 col2\" >{&#x27;query&#x27;: &#x27;documents about florida&#x27;, &#x27;filters&#x27;: {&#x27;op&#x27;: &#x27;or_&#x27;, &#x27;filters&#x27;: [[{&#x27;attribute&#x27;: &#x27;pub_year&#x27;, &#x27;op&#x27;: &#x27;&gt;=&#x27;, &#x27;value&#x27;: 2013}, {&#x27;attribute&#x27;: &#x27;author&#x27;, &#x27;op&#x27;: &#x27;=&#x27;, &#x27;value&#x27;: &#x27;mama bear&#x27;}]]}}</td>\n",
       "      <td id=\"T_4c82e_row1_col3\" class=\"data row1 col3\" >[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_4c82e_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "      <td id=\"T_4c82e_row2_col0\" class=\"data row2 col0\" >smells like sunshine</td>\n",
       "      <td id=\"T_4c82e_row2_col1\" class=\"data row2 col1\" ><style>pre { line-height: 125%; }<br/>td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>.output_html .hll { background-color: #ffffcc }<br/>.output_html { background: #f8f8f8; }<br/>.output_html .c { color: #3D7B7B; font-style: italic } /* Comment */<br/>.output_html .err { border: 1px solid #FF0000 } /* Error */<br/>.output_html .k { color: #008000; font-weight: bold } /* Keyword */<br/>.output_html .o { color: #666666 } /* Operator */<br/>.output_html .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */<br/>.output_html .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */<br/>.output_html .cp { color: #9C6500 } /* Comment.Preproc */<br/>.output_html .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */<br/>.output_html .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */<br/>.output_html .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */<br/>.output_html .gd { color: #A00000 } /* Generic.Deleted */<br/>.output_html .ge { font-style: italic } /* Generic.Emph */<br/>.output_html .gr { color: #E40000 } /* Generic.Error */<br/>.output_html .gh { color: #000080; font-weight: bold } /* Generic.Heading */<br/>.output_html .gi { color: #008400 } /* Generic.Inserted */<br/>.output_html .go { color: #717171 } /* Generic.Output */<br/>.output_html .gp { color: #000080; font-weight: bold } /* Generic.Prompt */<br/>.output_html .gs { font-weight: bold } /* Generic.Strong */<br/>.output_html .gu { color: #800080; font-weight: bold } /* Generic.Subheading */<br/>.output_html .gt { color: #0044DD } /* Generic.Traceback */<br/>.output_html .kc { color: #008000; font-weight: bold } /* Keyword.Constant */<br/>.output_html .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */<br/>.output_html .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */<br/>.output_html .kp { color: #008000 } /* Keyword.Pseudo */<br/>.output_html .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */<br/>.output_html .kt { color: #B00040 } /* Keyword.Type */<br/>.output_html .m { color: #666666 } /* Literal.Number */<br/>.output_html .s { color: #BA2121 } /* Literal.String */<br/>.output_html .na { color: #687822 } /* Name.Attribute */<br/>.output_html .nb { color: #008000 } /* Name.Builtin */<br/>.output_html .nc { color: #0000FF; font-weight: bold } /* Name.Class */<br/>.output_html .no { color: #880000 } /* Name.Constant */<br/>.output_html .nd { color: #AA22FF } /* Name.Decorator */<br/>.output_html .ni { color: #717171; font-weight: bold } /* Name.Entity */<br/>.output_html .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */<br/>.output_html .nf { color: #0000FF } /* Name.Function */<br/>.output_html .nl { color: #767600 } /* Name.Label */<br/>.output_html .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */<br/>.output_html .nt { color: #008000; font-weight: bold } /* Name.Tag */<br/>.output_html .nv { color: #19177C } /* Name.Variable */<br/>.output_html .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */<br/>.output_html .w { color: #bbbbbb } /* Text.Whitespace */<br/>.output_html .mb { color: #666666 } /* Literal.Number.Bin */<br/>.output_html .mf { color: #666666 } /* Literal.Number.Float */<br/>.output_html .mh { color: #666666 } /* Literal.Number.Hex */<br/>.output_html .mi { color: #666666 } /* Literal.Number.Integer */<br/>.output_html .mo { color: #666666 } /* Literal.Number.Oct */<br/>.output_html .sa { color: #BA2121 } /* Literal.String.Affix */<br/>.output_html .sb { color: #BA2121 } /* Literal.String.Backtick */<br/>.output_html .sc { color: #BA2121 } /* Literal.String.Char */<br/>.output_html .dl { color: #BA2121 } /* Literal.String.Delimiter */<br/>.output_html .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */<br/>.output_html .s2 { color: #BA2121 } /* Literal.String.Double */<br/>.output_html .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */<br/>.output_html .sh { color: #BA2121 } /* Literal.String.Heredoc */<br/>.output_html .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */<br/>.output_html .sx { color: #008000 } /* Literal.String.Other */<br/>.output_html .sr { color: #A45A77 } /* Literal.String.Regex */<br/>.output_html .s1 { color: #BA2121 } /* Literal.String.Single */<br/>.output_html .ss { color: #19177C } /* Literal.String.Symbol */<br/>.output_html .bp { color: #008000 } /* Name.Builtin.Pseudo */<br/>.output_html .fm { color: #0000FF } /* Name.Function.Magic */<br/>.output_html .vc { color: #19177C } /* Name.Variable.Class */<br/>.output_html .vg { color: #19177C } /* Name.Variable.Global */<br/>.output_html .vi { color: #19177C } /* Name.Variable.Instance */<br/>.output_html .vm { color: #19177C } /* Name.Variable.Magic */<br/>.output_html .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"k\">var</span><span class=\"w\"> </span><span class=\"n\">result</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"n\">request</span><span class=\"p\">(</span><span class=\"s2\">&quot;smells like sunshine&quot;</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"nb nb-Type\">null</span><span class=\"p\">)</span><br/></pre></div></td>\n",
       "      <td id=\"T_4c82e_row2_col2\" class=\"data row2 col2\" >{&#x27;query&#x27;: &#x27;smells like sunshine&#x27;, &#x27;filters&#x27;: None}</td>\n",
       "      <td id=\"T_4c82e_row2_col3\" class=\"data row2 col3\" >[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_4c82e_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "      <td id=\"T_4c82e_row3_col0\" class=\"data row3 col0\" >documents that discuss $5</td>\n",
       "      <td id=\"T_4c82e_row3_col1\" class=\"data row3 col1\" ><style>pre { line-height: 125%; }<br/>td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>.output_html .hll { background-color: #ffffcc }<br/>.output_html { background: #f8f8f8; }<br/>.output_html .c { color: #3D7B7B; font-style: italic } /* Comment */<br/>.output_html .err { border: 1px solid #FF0000 } /* Error */<br/>.output_html .k { color: #008000; font-weight: bold } /* Keyword */<br/>.output_html .o { color: #666666 } /* Operator */<br/>.output_html .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */<br/>.output_html .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */<br/>.output_html .cp { color: #9C6500 } /* Comment.Preproc */<br/>.output_html .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */<br/>.output_html .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */<br/>.output_html .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */<br/>.output_html .gd { color: #A00000 } /* Generic.Deleted */<br/>.output_html .ge { font-style: italic } /* Generic.Emph */<br/>.output_html .gr { color: #E40000 } /* Generic.Error */<br/>.output_html .gh { color: #000080; font-weight: bold } /* Generic.Heading */<br/>.output_html .gi { color: #008400 } /* Generic.Inserted */<br/>.output_html .go { color: #717171 } /* Generic.Output */<br/>.output_html .gp { color: #000080; font-weight: bold } /* Generic.Prompt */<br/>.output_html .gs { font-weight: bold } /* Generic.Strong */<br/>.output_html .gu { color: #800080; font-weight: bold } /* Generic.Subheading */<br/>.output_html .gt { color: #0044DD } /* Generic.Traceback */<br/>.output_html .kc { color: #008000; font-weight: bold } /* Keyword.Constant */<br/>.output_html .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */<br/>.output_html .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */<br/>.output_html .kp { color: #008000 } /* Keyword.Pseudo */<br/>.output_html .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */<br/>.output_html .kt { color: #B00040 } /* Keyword.Type */<br/>.output_html .m { color: #666666 } /* Literal.Number */<br/>.output_html .s { color: #BA2121 } /* Literal.String */<br/>.output_html .na { color: #687822 } /* Name.Attribute */<br/>.output_html .nb { color: #008000 } /* Name.Builtin */<br/>.output_html .nc { color: #0000FF; font-weight: bold } /* Name.Class */<br/>.output_html .no { color: #880000 } /* Name.Constant */<br/>.output_html .nd { color: #AA22FF } /* Name.Decorator */<br/>.output_html .ni { color: #717171; font-weight: bold } /* Name.Entity */<br/>.output_html .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */<br/>.output_html .nf { color: #0000FF } /* Name.Function */<br/>.output_html .nl { color: #767600 } /* Name.Label */<br/>.output_html .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */<br/>.output_html .nt { color: #008000; font-weight: bold } /* Name.Tag */<br/>.output_html .nv { color: #19177C } /* Name.Variable */<br/>.output_html .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */<br/>.output_html .w { color: #bbbbbb } /* Text.Whitespace */<br/>.output_html .mb { color: #666666 } /* Literal.Number.Bin */<br/>.output_html .mf { color: #666666 } /* Literal.Number.Float */<br/>.output_html .mh { color: #666666 } /* Literal.Number.Hex */<br/>.output_html .mi { color: #666666 } /* Literal.Number.Integer */<br/>.output_html .mo { color: #666666 } /* Literal.Number.Oct */<br/>.output_html .sa { color: #BA2121 } /* Literal.String.Affix */<br/>.output_html .sb { color: #BA2121 } /* Literal.String.Backtick */<br/>.output_html .sc { color: #BA2121 } /* Literal.String.Char */<br/>.output_html .dl { color: #BA2121 } /* Literal.String.Delimiter */<br/>.output_html .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */<br/>.output_html .s2 { color: #BA2121 } /* Literal.String.Double */<br/>.output_html .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */<br/>.output_html .sh { color: #BA2121 } /* Literal.String.Heredoc */<br/>.output_html .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */<br/>.output_html .sx { color: #008000 } /* Literal.String.Other */<br/>.output_html .sr { color: #A45A77 } /* Literal.String.Regex */<br/>.output_html .s1 { color: #BA2121 } /* Literal.String.Single */<br/>.output_html .ss { color: #19177C } /* Literal.String.Symbol */<br/>.output_html .bp { color: #008000 } /* Name.Builtin.Pseudo */<br/>.output_html .fm { color: #0000FF } /* Name.Function.Magic */<br/>.output_html .vc { color: #19177C } /* Name.Variable.Class */<br/>.output_html .vg { color: #19177C } /* Name.Variable.Global */<br/>.output_html .vi { color: #19177C } /* Name.Variable.Instance */<br/>.output_html .vm { color: #19177C } /* Name.Variable.Magic */<br/>.output_html .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"k\">var</span><span class=\"w\"> </span><span class=\"n\">result</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"n\">request</span><span class=\"p\">(</span><span class=\"s2\">&quot;documents that discuss $5&quot;</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"n\">eq</span><span class=\"p\">(</span><span class=\"s2\">&quot;price&quot;</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"mi\">5</span><span class=\"p\">))</span><br/></pre></div></td>\n",
       "      <td id=\"T_4c82e_row3_col2\" class=\"data row3 col2\" >{&#x27;query&#x27;: &#x27;documents that discuss $5&#x27;, &#x27;filters&#x27;: {&#x27;attribute&#x27;: &#x27;price&#x27;, &#x27;op&#x27;: &#x27;=&#x27;, &#x27;value&#x27;: 5}}</td>\n",
       "      <td id=\"T_4c82e_row3_col3\" class=\"data row3 col3\" >[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_4c82e_level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
       "      <td id=\"T_4c82e_row4_col0\" class=\"data row4 col0\" >documents that discuss the $50<br/>debt of the bank</td>\n",
       "      <td id=\"T_4c82e_row4_col1\" class=\"data row4 col1\" ><style>pre { line-height: 125%; }<br/>td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>.output_html .hll { background-color: #ffffcc }<br/>.output_html { background: #f8f8f8; }<br/>.output_html .c { color: #3D7B7B; font-style: italic } /* Comment */<br/>.output_html .err { border: 1px solid #FF0000 } /* Error */<br/>.output_html .k { color: #008000; font-weight: bold } /* Keyword */<br/>.output_html .o { color: #666666 } /* Operator */<br/>.output_html .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */<br/>.output_html .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */<br/>.output_html .cp { color: #9C6500 } /* Comment.Preproc */<br/>.output_html .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */<br/>.output_html .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */<br/>.output_html .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */<br/>.output_html .gd { color: #A00000 } /* Generic.Deleted */<br/>.output_html .ge { font-style: italic } /* Generic.Emph */<br/>.output_html .gr { color: #E40000 } /* Generic.Error */<br/>.output_html .gh { color: #000080; font-weight: bold } /* Generic.Heading */<br/>.output_html .gi { color: #008400 } /* Generic.Inserted */<br/>.output_html .go { color: #717171 } /* Generic.Output */<br/>.output_html .gp { color: #000080; font-weight: bold } /* Generic.Prompt */<br/>.output_html .gs { font-weight: bold } /* Generic.Strong */<br/>.output_html .gu { color: #800080; font-weight: bold } /* Generic.Subheading */<br/>.output_html .gt { color: #0044DD } /* Generic.Traceback */<br/>.output_html .kc { color: #008000; font-weight: bold } /* Keyword.Constant */<br/>.output_html .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */<br/>.output_html .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */<br/>.output_html .kp { color: #008000 } /* Keyword.Pseudo */<br/>.output_html .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */<br/>.output_html .kt { color: #B00040 } /* Keyword.Type */<br/>.output_html .m { color: #666666 } /* Literal.Number */<br/>.output_html .s { color: #BA2121 } /* Literal.String */<br/>.output_html .na { color: #687822 } /* Name.Attribute */<br/>.output_html .nb { color: #008000 } /* Name.Builtin */<br/>.output_html .nc { color: #0000FF; font-weight: bold } /* Name.Class */<br/>.output_html .no { color: #880000 } /* Name.Constant */<br/>.output_html .nd { color: #AA22FF } /* Name.Decorator */<br/>.output_html .ni { color: #717171; font-weight: bold } /* Name.Entity */<br/>.output_html .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */<br/>.output_html .nf { color: #0000FF } /* Name.Function */<br/>.output_html .nl { color: #767600 } /* Name.Label */<br/>.output_html .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */<br/>.output_html .nt { color: #008000; font-weight: bold } /* Name.Tag */<br/>.output_html .nv { color: #19177C } /* Name.Variable */<br/>.output_html .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */<br/>.output_html .w { color: #bbbbbb } /* Text.Whitespace */<br/>.output_html .mb { color: #666666 } /* Literal.Number.Bin */<br/>.output_html .mf { color: #666666 } /* Literal.Number.Float */<br/>.output_html .mh { color: #666666 } /* Literal.Number.Hex */<br/>.output_html .mi { color: #666666 } /* Literal.Number.Integer */<br/>.output_html .mo { color: #666666 } /* Literal.Number.Oct */<br/>.output_html .sa { color: #BA2121 } /* Literal.String.Affix */<br/>.output_html .sb { color: #BA2121 } /* Literal.String.Backtick */<br/>.output_html .sc { color: #BA2121 } /* Literal.String.Char */<br/>.output_html .dl { color: #BA2121 } /* Literal.String.Delimiter */<br/>.output_html .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */<br/>.output_html .s2 { color: #BA2121 } /* Literal.String.Double */<br/>.output_html .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */<br/>.output_html .sh { color: #BA2121 } /* Literal.String.Heredoc */<br/>.output_html .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */<br/>.output_html .sx { color: #008000 } /* Literal.String.Other */<br/>.output_html .sr { color: #A45A77 } /* Literal.String.Regex */<br/>.output_html .s1 { color: #BA2121 } /* Literal.String.Single */<br/>.output_html .ss { color: #19177C } /* Literal.String.Symbol */<br/>.output_html .bp { color: #008000 } /* Name.Builtin.Pseudo */<br/>.output_html .fm { color: #0000FF } /* Name.Function.Magic */<br/>.output_html .vc { color: #19177C } /* Name.Variable.Class */<br/>.output_html .vg { color: #19177C } /* Name.Variable.Global */<br/>.output_html .vi { color: #19177C } /* Name.Variable.Instance */<br/>.output_html .vm { color: #19177C } /* Name.Variable.Magic */<br/>.output_html .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"k\">var</span><span class=\"w\"> </span><span class=\"n\">result</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"n\">request</span><span class=\"p\">(</span><span class=\"s2\">&quot;documents that discuss the $50 debt of the bank&quot;</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"nb nb-Type\">null</span><span class=\"p\">)</span><br/></pre></div></td>\n",
       "      <td id=\"T_4c82e_row4_col2\" class=\"data row4 col2\" >{&#x27;query&#x27;: &#x27;documents that discuss the $50 debt of the bank&#x27;, &#x27;filters&#x27;: None}</td>\n",
       "      <td id=\"T_4c82e_row4_col3\" class=\"data row4 col3\" >[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_4c82e_level0_row5\" class=\"row_heading level0 row5\" >5</th>\n",
       "      <td id=\"T_4c82e_row5_col0\" class=\"data row5 col0\" >docs that cost more than $150</td>\n",
       "      <td id=\"T_4c82e_row5_col1\" class=\"data row5 col1\" ><style>pre { line-height: 125%; }<br/>td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }<br/>td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }<br/>.output_html .hll { background-color: #ffffcc }<br/>.output_html { background: #f8f8f8; }<br/>.output_html .c { color: #3D7B7B; font-style: italic } /* Comment */<br/>.output_html .err { border: 1px solid #FF0000 } /* Error */<br/>.output_html .k { color: #008000; font-weight: bold } /* Keyword */<br/>.output_html .o { color: #666666 } /* Operator */<br/>.output_html .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */<br/>.output_html .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */<br/>.output_html .cp { color: #9C6500 } /* Comment.Preproc */<br/>.output_html .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */<br/>.output_html .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */<br/>.output_html .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */<br/>.output_html .gd { color: #A00000 } /* Generic.Deleted */<br/>.output_html .ge { font-style: italic } /* Generic.Emph */<br/>.output_html .gr { color: #E40000 } /* Generic.Error */<br/>.output_html .gh { color: #000080; font-weight: bold } /* Generic.Heading */<br/>.output_html .gi { color: #008400 } /* Generic.Inserted */<br/>.output_html .go { color: #717171 } /* Generic.Output */<br/>.output_html .gp { color: #000080; font-weight: bold } /* Generic.Prompt */<br/>.output_html .gs { font-weight: bold } /* Generic.Strong */<br/>.output_html .gu { color: #800080; font-weight: bold } /* Generic.Subheading */<br/>.output_html .gt { color: #0044DD } /* Generic.Traceback */<br/>.output_html .kc { color: #008000; font-weight: bold } /* Keyword.Constant */<br/>.output_html .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */<br/>.output_html .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */<br/>.output_html .kp { color: #008000 } /* Keyword.Pseudo */<br/>.output_html .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */<br/>.output_html .kt { color: #B00040 } /* Keyword.Type */<br/>.output_html .m { color: #666666 } /* Literal.Number */<br/>.output_html .s { color: #BA2121 } /* Literal.String */<br/>.output_html .na { color: #687822 } /* Name.Attribute */<br/>.output_html .nb { color: #008000 } /* Name.Builtin */<br/>.output_html .nc { color: #0000FF; font-weight: bold } /* Name.Class */<br/>.output_html .no { color: #880000 } /* Name.Constant */<br/>.output_html .nd { color: #AA22FF } /* Name.Decorator */<br/>.output_html .ni { color: #717171; font-weight: bold } /* Name.Entity */<br/>.output_html .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */<br/>.output_html .nf { color: #0000FF } /* Name.Function */<br/>.output_html .nl { color: #767600 } /* Name.Label */<br/>.output_html .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */<br/>.output_html .nt { color: #008000; font-weight: bold } /* Name.Tag */<br/>.output_html .nv { color: #19177C } /* Name.Variable */<br/>.output_html .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */<br/>.output_html .w { color: #bbbbbb } /* Text.Whitespace */<br/>.output_html .mb { color: #666666 } /* Literal.Number.Bin */<br/>.output_html .mf { color: #666666 } /* Literal.Number.Float */<br/>.output_html .mh { color: #666666 } /* Literal.Number.Hex */<br/>.output_html .mi { color: #666666 } /* Literal.Number.Integer */<br/>.output_html .mo { color: #666666 } /* Literal.Number.Oct */<br/>.output_html .sa { color: #BA2121 } /* Literal.String.Affix */<br/>.output_html .sb { color: #BA2121 } /* Literal.String.Backtick */<br/>.output_html .sc { color: #BA2121 } /* Literal.String.Char */<br/>.output_html .dl { color: #BA2121 } /* Literal.String.Delimiter */<br/>.output_html .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */<br/>.output_html .s2 { color: #BA2121 } /* Literal.String.Double */<br/>.output_html .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */<br/>.output_html .sh { color: #BA2121 } /* Literal.String.Heredoc */<br/>.output_html .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */<br/>.output_html .sx { color: #008000 } /* Literal.String.Other */<br/>.output_html .sr { color: #A45A77 } /* Literal.String.Regex */<br/>.output_html .s1 { color: #BA2121 } /* Literal.String.Single */<br/>.output_html .ss { color: #19177C } /* Literal.String.Symbol */<br/>.output_html .bp { color: #008000 } /* Name.Builtin.Pseudo */<br/>.output_html .fm { color: #0000FF } /* Name.Function.Magic */<br/>.output_html .vc { color: #19177C } /* Name.Variable.Class */<br/>.output_html .vg { color: #19177C } /* Name.Variable.Global */<br/>.output_html .vi { color: #19177C } /* Name.Variable.Instance */<br/>.output_html .vm { color: #19177C } /* Name.Variable.Magic */<br/>.output_html .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"k\">var</span><span class=\"w\"> </span><span class=\"n\">result</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"n\">request</span><span class=\"p\">(</span><span class=\"nb nb-Type\">null</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"n\">gt</span><span class=\"p\">(</span><span class=\"s2\">&quot;price&quot;</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"mi\">150</span><span class=\"p\">))</span><br/></pre></div></td>\n",
       "      <td id=\"T_4c82e_row5_col2\" class=\"data row5 col2\" >{&#x27;query&#x27;: None, &#x27;filters&#x27;: {&#x27;attribute&#x27;: &#x27;price&#x27;, &#x27;op&#x27;: &#x27;&gt;&#x27;, &#x27;value&#x27;: 150}}</td>\n",
       "      <td id=\"T_4c82e_row5_col3\" class=\"data row5 col3\" >[]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "display_html_results(\n",
    "    [as_html_dict(r) for r in results], columns=[\"query\", \"code\", \"result\", \"errors\"]\n",
    ")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
